@extends('layouts.app')
@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">更改个人相片</div>
                    <div class="panel-body">
                        <img src="/uploads/avatars/{{$user->avatar}}"
                             style="width: 150px;height: 150px;float: left; border-radius: 50%;margin-right: 25px">
                        <h2>{{$user->name}}'s Profile</h2>
                        <form enctype="multipart/form-data" action="/profile" method="POST">
                            <label>上传个人相片</label>
                            <input type="file" name="avatar">
                            <input type="hidden" name="_token" value="{{csrf_token()}}">
                            <input type="submit" class="pull-right btn btm-sm btn-primary">
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">更改个人信息</div>
                    <div class="panel-body">
                        @if (\Session::has('err'))
                        {{\Session::get('err')->first()}}
                        @endif
                            @if (\Session::has('success'))
                                <div class="alert alert-success">
                                    {!! \Session::get('success') !!}
                                </div>
                            @endif
                        <form action="{{url('/user/updateBasic')}}" method="post" role="form">
                            <div class="form-group">
                                <label for="name">姓名</label>
                                <input type="text" class="form-control" name="name" id="name"
                                       value="{{Auth::user()->name}}">
                            <input type="hidden" name="_token" value="{{csrf_token()}}">
                            </div>
                            <div class="form-group">
                                <label for="姓别" class="col-sm-2 control-label"></label>
                                <select class="form-control" id="sex" name="sex">
                                    <option value="1">男</option>
                                    <option value="0">女</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="name">邮箱</label>
                                <input type="email" class="form-control" name="email" id="email"
                                       value="{{Auth::user()->email}}">
                            </div>
                            <div class="form-group">
                                <div class="col-md-6 col-md-offset-4">
                                    <button type="submit" class="btn btn-primary">
                                        更新
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">更新密码</div>
                    <div class="panel-body">
                        @if ($errors->any())
                            <div class="alert alert-danger">
                                {{ $errors->first()}}
                            </div>
                            @else
                        @endif
                            <form id="form-change-password" role="form" method="POST" action="{{url('/user/updateCredentials')}}" novalidate class="form-horizontal">
                                <div class="col-md-9">
                                    <label for="current-password" class="col-sm-4 control-label">当前密码</label>
                                    <div class="col-sm-8">
                                        <div class="form-group">
                                            <input type="password" class="form-control" id="current-password" name="current-password">
                                            <input type="hidden" name="_token" value="{{csrf_token()}}">
                                        </div>
                                    </div>
                                    <label for="password" class="col-sm-4 control-label">新密码</label>
                                    <div class="col-sm-8">
                                        <div class="form-group">
                                            <input type="password" class="form-control" id="password" name="password">
                                        </div>
                                    </div>
                                    <label for="password_confirmation" class="col-sm-4 control-label">重复新密码</label>
                                    <div class="col-sm-8">
                                        <div class="form-group">
                                            <input type="password" class="form-control" id="password_confirmation" name="password_confirmation">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-5 col-sm-6">
                                        <button type="submit" class="btn btn-danger">更新</button>
                                    </div>
                                </div>
                            </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
@section('more_scripts')

@stop
